Pipette1 = Widget.extend({
	runningAction:null,
	ctor:function(){
		this._super();
		this.init();
		this.initAction();
		this.setTag(TAG_PIPETTE1_ALL);
		this.suction();
	},
	init:function(){
		//移液管
		this.body = new Button(this, 10, TAG_PIPETTE1, "#pipette1.png", this.callback,this);
		
		var flow1=new Button(this.body,10,TAG_PIPETTE_FLOW1,"#flow2.png",this.callback,this);
		flow1.setAnchorPoint(cc.p(0.5, 1));
		flow1.setPosition(cc.p(this.body.width*0.45,this.body.height*0.04));
		flow1.setScale(0.5,1);
		flow1.setOpacity(0);
	},
	show:function(){
		var show1=new Button(this.body,10,TAG_SHOW3,"#show4.png",this.callback,this); 
		show1.setPosition(cc.p(this.body.width*4.5,this.body.height*0.35));
		show1.setOpacity(0);
		var fadein=cc.fadeIn(0.1);
		var fadeout=cc.fadeOut(0.1);
		show1.runAction(cc.sequence(fadein,cc.delayTime(1),fadeout));
	},
	show1:function(){
		var show2=new Button(this.body,10,TAG_SHOW4,"#show3.png",this.callback,this); 
		show2.setPosition(cc.p(this.body.width*4.5,this.body.height*0.32));
		show2.setOpacity(0);
		var fadein=cc.fadeIn(0.1);
		var fadeout=cc.fadeOut(0.1);
		show2.runAction(cc.sequence(fadein,cc.delayTime(1),fadeout));
	},
	initAction:function(){
		var animFrames=[];
		for(var i=1;i<6;i++){
			var str="action/pipette"+i+".png";
			var frame=cc.spriteFrameCache.getSpriteFrame(str);
			animFrames.push(frame);
		}
		var animation=new cc.Animation(animFrames,0.2)
		this.runningAction=cc.repeat(cc.animate(animation),1);
		this.runningAction.retain();
	},
	show3:function(){
		var flow1=this.body.getChildByTag(TAG_PIPETTE_FLOW1);
		var fadein=cc.fadeIn(0.1);
		var fadeout=cc.fadeOut(0.1);
		flow1.runAction(cc.sequence(fadein,cc.delayTime(1.5),fadeout));
	},
	suction:function(){
		var func=cc.callFunc(function() {
			gg.flow.next();
		},this);
		var k2cro4=ll.run.getChildByTag(TAG_K2CrO4_ALL);
		var ber=cc.bezierBy(1, [cc.p(10, 150),cc.p(80,160),cc.p(260,30)]);
		this.body.runAction(cc.sequence(cc.delayTime(1),this.runningAction,cc.callFunc(function() {
			this.show();
		},this),cc.delayTime(1),ber,cc.spawn(cc.callFunc(function() {
			this.body.setSpriteFrame("action/pipette4.png");
			this.show1();
		},this),cc.callFunc(function() {
			this.show3();
		}, this)),cc.delayTime(1.5),cc.callFunc(function() {
			this.body.setVisible(false);
			k2cro4.setVisible(false);
		},this),func));
	}
});